﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DNNspot.LiveChat.DataModel
{
    public partial class PortalSetting
    {
        public static String Get(int portalId, string settingName)
        {
            String settingValue = null;

            var q = new PortalSettingQuery();
            q.Where(q.PortalId == portalId && q.SettingName == settingName);

            var portalSetting = new PortalSetting();
            if (portalSetting.Load(q)) 
                settingValue = portalSetting.SettingValue;

            return settingValue;
        }

        public static void Set(int portalId, string settingName, string settingValue)
        {
            var q = new PortalSettingQuery();
            q.Where(q.PortalId == portalId && q.SettingName == settingName);

            var portalSetting = new PortalSetting();
            portalSetting.Load(q);

            portalSetting.PortalId = portalId;
            portalSetting.SettingName = settingName;
            portalSetting.SettingValue = settingValue;

            portalSetting.Save();
        }
    }

    public partial class PortalSettingCollection
    {
        
    }
}
